package com.hs.excel.demos;
import com.alibaba.excel.EasyExcel;
import com.hs.excel.demos.listenter.InsertListener;
import com.hs.excel.demos.listenter.updateListener;
import com.hs.excel.demos.pojo.RequestParm;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.springframework.test.util.AssertionErrors.assertFalse;
import static org.springframework.test.util.AssertionErrors.assertTrue;


@SpringBootTest
@Slf4j
public class Mytest {

    @Test
    void Insert2() {
        String fileName = "text.xlsx";
        EasyExcel.read(fileName, new InsertListener(new RequestParm("USER",true))).sheet().doRead();
    }

    //更新设置where条件 and
    @Test
    void updtesql33() {
        String fileName = "zybxzhuxiao2.xlsx";
        // 设置条件
        List<String> list = new ArrayList<>();
        list.add("taskId");
        RequestParm par = new RequestParm("LP_FLOW22", true,"oracle");
        par.setTerms(list);
        EasyExcel.read(fileName, new updateListener(par)).sheet().doRead();
    }



    @Test
    void Insert22() {
        String fileName = "bydorg3.xls";
        EasyExcel.read(fileName, new InsertListener(new RequestParm("PM_ORGANIZATION_INFO",true,"oracle"))).sheet().doRead();
    }


    @Test
    void Insert33() {
        String fileName = "bydorg4 4.xlsx";
        EasyExcel.read(fileName, new com.hs.excel.demos.listenter.Test(new RequestParm("PM_ORGANIZATION_INFO",null,null))).sheet().doRead();
    }
    @Test
    void Insert999() {
        String expected = "bydorg4 4.xlsx";
        String actual = "bydorg4 4.xlsx";
        assertEquals(expected, actual);


    }




}
